<?php
namespace app\index\controller;

use think\Controller;

class About extends Common
{
    public function _initialize()
    {
        parent::_initialize();
        $this->assign('active', '关于我们');
        $url = input('param.id', 0) > 0 ? '/about/' . input('param.id', 0) : '/about';
        $this->assign('nav_image', get_nav_img($url));
    }
    // 关于我们页面
    public function index() {
        $id = input('param.id', 0);

        $where['a.cate_id'] = 8;
        if ($id > 0) {
            $where['a.id'] = $id;
        }
        // 获取公司介绍
        $about = db('article')
            ->alias('a')
            ->field('a.*, ac.content')
            ->join("osl_article_content ac", "ac.article_id = a.id", "LEFT")
            ->where($where)
            ->find();
        $this->assign('about', $about);

        $article = db('article')->where('cate_id', 8)->select();
        $this->assign('article', $article);

        return view();
    }
}
